package com.atguigu.realtime.join;

import com.atguigu.realtime.app.BaseSqlApp;
import com.atguigu.realtime.util.SQLUtil;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

/**
 * @Author lzc
 * @Date 2023/3/13 10:32
 */
public class ConsumeLeftJoin_UpsertKafka extends BaseSqlApp {
    public static void main(String[] args) {
        new ConsumeLeftJoin_UpsertKafka().init(
            5555,
            2,
            "ConsumeLeftJoin_UpsertKafka"
        );
        
    }
    
    @Override
    public void handle(StreamExecutionEnvironment env,
                       StreamTableEnvironment tEnv) {
        tEnv.executeSql("create table t12_left(" +
                            " id int, " +
                            " abc string, " +
                            " age int," +
                            " primary key(id) not enforced " +
                            ")" + SQLUtil.getUpsertKafkaDDL("t12_left"));
        
        tEnv.sqlQuery("select sum(age) sum_age from t12_left where id=5 group by id").execute().print();
        
        
    }
}
/*
 
 */